﻿using HlELock.Core.Models;
using HlELock.Domain.Entities;
using System.Configuration;

namespace HlELock.Core
{

    public static class RegionNames
    {
        public const string HotelRegion = "HotelContentRegion";
        public const string HotelMainRibbon = "HotelMainRibbon";
        public const string HotelMainContent = "HotelMainContent";
        public const string DialogWindowRegion = "DialogWindowRegion";
    }

    public static class MyAppContext
    {
        /// <summary>
        /// 是否三方
        /// </summary>
        public static bool IsSf { get; set; } = false;

        /// <summary>
        /// 扇区
        /// </summary>
        public static string Sector { get; set; }

        public static int VID { get; set; }
        public static int PID { get; set; }

        /// <summary>
        /// 是否是酒店
        /// </summary>
        public static bool IsHotel { get; set; }
        public static HotelInfo HotelInfo { get; set; }
        public static AgencyResponse Agency { get; set; }

        public static LocalUser CurrentUser { get; set; }

        public static string AccessToken { get; set; }

        public static IUsbHid Device { get; set; }

        public const string PublicKey = "MIIBCgKCAQEAuxXItgfUTs6j/Tfw7naXtFRt9eMrf0kw3YGy8C0gWlswzephPJLQLTBYflzPcWTjII6m5bYrYPLW2Xld5IzIdM/iYoXPymkBfg12CbHILs0RFkUnwsSRj5u9K/qs/JzAVGccipRv2Llsrz4mdZKyKlYTc4RlYAg55z0CpzbZ0BmUrB49ss7qexJ8IZQKaaFGeAaYghF6Pf/cC2rvWKsdiuDt/bUGo6nmsEu92FS/kQREFQIsA+mW8vSOvVttA6IoqQnT99mxqbEQE4GIKlbq9kZaQZ4jP5DwU3bvdrrABtOAroRt4U0mwDBd155gjil/yd1ItIWEHk2L1MLIHF06JQIDAQAB";


        public static ICardService CardService { get; set; }

        public static void Init()
        {
            var pid = ConfigurationManager.AppSettings["PID"];
            var vid = ConfigurationManager.AppSettings["VID"];
            if (!int.TryParse(pid, out int p))
            {
                p = 55555;
            }
            if (!int.TryParse(vid, out int v))
            {
                v = 1027;
            }
            MyAppContext.PID = p;
            MyAppContext.VID = v;


            MyAppContext.IsSf = ConfigurationManager.AppSettings["isSf"]?.ToLower() == "true";

        }

    }
}
